<template>
	<view class="visit">
		<view class="fox" style="width: 100%;height: 30%;">
			<text style="vertical-align:middle;" >已完成：</text>
			<text style="vertical-align:middle;color: #19BE6B;" >34</text>
			<text style="vertical-align:middle;" >户</text>
			<text style="vertical-align:middle;margin-left: 20% ;" >未完成：</text>
			<text style="color: red;">7</text>
			<text>户</text>
			<text style="color: #19BE6B;vertical-align:middle;margin-left: 18% ;"@tap="navTo(`/pages/notice/notice?id=1`)" >查看汇总</text>
				<text class="cell-more iconfont iconyou"></text>
		</view>

		<view class="notify-list">
			
			<view>
				
				<view class="box" style="width: 100%; height: 30px;background-color: #fff;">
					
					<view class="input-item">
						
						<picker  mode="date" v-model="date" @change="bindDateChange">
							<text class="">走访日期：</text>
							<view class="date" >
							
							{{
								date || '请选择日期'
							}}
							</view>
						</picker>
						
						
					</view>
					
					<view class="input-item" style="margin-left: 5% ">
										<text><font>类型:</font></text>
										     <select name="status" id="status" v-model="selected" class="tit">
										         <option value="">全部</option>
										         <option value="1">已走访</option>
										         <option value="2">未走访</option>
										     </select>
									</view>
										<view class="input-item" style=" margin-left: 10% ;">
													<button type="primary" style="border-radius:25px;background-color: #39B54A;height: 27px;line-height: 30px;">查询</button>
													</view>
				</view>
				
			</view>
			
			<view  class="row" @tap="navTo(`/pages/application/index?id=1`)">
				<view class="carrier">
					
					<view class="notify-wrapper">
						
						<view class="title-in1line"><font>张三</font></view>
						<view class="content in2line">52230874361</view>
					</view>
					<view class="notify-wrapper">
						<view class="fdex" style="margin: 0 auto;float: right;">
						<view class="title in1line" style="margin-left: 50%;"><font color="green" >已走访</font></view>
						<view class="content in2line">2020-12-12 12:32</view>
						</view>
					</view>
					<text class="cell-more iconfont iconyou"></text>
				</view>
				
			</view>
			<view  class="row" @tap="navTo(`/pages/works/detail?id=1`)">
				<view class="carrier">
					<view class="notify-wrapper">
						<view class="title-in1line">张三</view>
						<view class="content in2line">52230874361</view>
					</view>
						<view class="notify-wrapper">
							<view class="fdex" style="margin: 0 auto;float: right;">
							<view class="title in1line" style="margin-left: 50%;"><font color="red" >未走访</font></view>
							<view class="content in2line">2020-12-12 12:32</view>
							</view>
						</view>
						<text class="cell-more iconfont iconyou"></text>
				</view>
			</view>
			<view  class="row" @tap="navTo(`/pages/works/detail?id=1`)">
				<view class="carrier">
					<view class="notify-wrapper">
						<view class="title-in1line">张三</view>
						<view class="content in2line">52230874361</view>
						
					</view>
					<view class="notify-wrapper">
						<view class="fdex" style="margin: 0 auto;float: right;">
						<view class="title in1line" style="margin-left: 50%;"><font color="green" >已走访</font></view>
						<view class="content in2line">2020-12-12 12:32</view>
						</view>
					</view>
					<text class="cell-more iconfont iconyou"></text>
				</view>
			</view>
			<view  class="row" @tap="navTo(`/pages/works/detail?id=1`)">
				<view class="carrier">
					<view class="notify-wrapper">
						<view class="title-in1line">张三</view>
						<view class="content in2line">52230874361</view>
						
					</view>
					<view class="notify-wrapper">
						<view class="fdex" style="margin: 0 auto;float: right;">
						<view class="title in1line" style="margin-left: 50%;"><font color="red" >未走访</font></view>
						<view class="content in2line">2020-12-12 12:32</view>
						</view>
					</view>
					<text class="cell-more iconfont iconyou"></text>
				</view>
			</view>
			<view  class="row" @tap="navTo(`/pages/works/detail?id=1`)">
				<view class="carrier">
					<view class="notify-wrapper">
						<view class="title-in1line">张三</view>
						<view class="content in2line">52230874361</view>
						
					</view>
					<view class="notify-wrapper">
						<view class="fdex" style="margin: 0 auto;float: right;">
						<view class="title in1line" style="margin-left: 50%;"><font color="green" >已走访</font></view>
						<view class="content in2line">2020-12-12 12:32</view>
						</view>
					</view>
					<text class="cell-more iconfont iconyou"></text>
				</view>
			</view>
			<view  class="row" @tap="navTo(`/pages/works/detail?id=1`)">
				<view class="carrier">
					<view class="notify-wrapper">
						<view class="title-in1line">张三</view>
						<view class="content in2line">52230874361</view>
						
					</view>
				<view class="notify-wrapper">
					<view class="fdex" style="margin: 0 auto;float: right;">
					<view class="title in1line" style="margin-left: 50%;"><font color="red" >未走访</font></view>
					<view class="content in2line">2020-12-12 12:32</view>
					</view>
				</view>
					<text class="cell-more iconfont iconyou"></text>
				</view>
			</view>
			<view  class="row" @tap="navTo(`/pages/works/detail?id=1`)">
				<view class="carrier">
					<view class="notify-wrapper">
						<view class="title-in1line">张三</view>
						<view class="content in2line">52230874361</view>
						
					</view>
					<view class="notify-wrapper">
						<view class="fdex" style="margin: 0 auto;float: right;">
						<view class="title in1line" style="margin-left: 50%;"><font color="green" >已走访</font></view>
						<view class="content in2line">2020-12-12 12:32</view>
						</view>
					</view>
					<text class="cell-more iconfont iconyou"></text>
				</view>
			</view>
		</view>
		
	</view>

</template>

<script>
	import {
		worksList
	} from '@/api/userInfo';
	import rfLoadMore from '@/components/oa-load-more/oa-load-more';
	import moment from '@/common/moment';
	import $mAssetsPath from '@/config/assets.config';
	import oaEmpty from '@/components/oa-empty';
	export default {
		components: {
			rfLoadMore,
			oaEmpty
		},
		data() {
			return {
				studyList: [{"id":"8","merchant_id":"2","title":"共创人类发展的美好未来","cover":"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/09/10/image_1599669475_VQXiR1bX.jpg","seo_key":"","seo_content":"","cate_id":"1","description":"“十三五”期间，中国不断扩大开放，深入推进共建“一带一路”，构建人类命运共同体共识不断巩固，务实合作根基不断夯实，全球治理空间不断拓展。","position":"0","content":"","link":"","author":"","view":"473","sort":"0","status":"1","created_at":"1601956562","updated_at":"1601956617"},{"id":"7","merchant_id":"2","title":"办公系统正式开通","cover":"http://wephp-oa.oss-cn-shenzhen.aliyuncs.com/images/2020/09/10/image_1599669347_KbFsxS3m.jpg","seo_key":"","seo_content":"","cate_id":"1","description":"办公系统正式开通，请大家下载安装应用","position":"0","content":"","link":"","author":"维博网络","view":"473","sort":"0","status":"1","created_at":"1601915568","updated_at":"1606156145"}],
				worksList: [],
				page: 1,
				// cate_id: '',
				loadingType: 'more',
				loading: true,
				hasLogin: false,
				moneySymbol: this.moneySymbol,
				// 控制滑动效果
				theIndex: null,
				oldIndex: null,
				selected:'',
				date: moment().format('YYYY年MM月DD日'),
				
			};
		},
		filters: {
			time(val) {
				return moment(val * 1000).format('YYYY年MM月DD日');
			},
		},
		async onShow(options) {
			await this.initData();
		},
		async onLoad(options) {
			await this.initData();
		},

		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.worksList = [];
			this.loading = true;
			this.getworksList('refresh');
		},
		// 加载更多
		onReachBottom() {
			if (this.loadingType === 'nomore') return;
			this.page++;
			this.getworksList();
		},

		methods: {
			bindDateChange(e) {
				this.date = e.target.value;
			},
			// 数据初始化
			initData() {
				this.hasLogin = this.$mStore.getters.hasLogin;
				this.page = 1;
				this.worksList.length = 0;
				this.getworksList();
				uni.setNavigationBarColor({
					frontColor: '#ffffff',
					backgroundColor: this.themeColor.color,
					animation: {
						duration: 400,
						timingFunc: 'easeIn'
					}
				})
			},
			// 获取资料列表
			async getworksList(type) {
				if (!this.hasLogin) {
					this.loading = false;
					if (type === 'refresh') uni.stopPullDownRefresh();
					uni.removeTabBarBadge({
						index: this.$mConstDataConfig.worksIndex
					});
					return;
				}
				await this.$http.get(`${worksList}`, {
						page: this.page
					}).then(r => {
						this.loading = false;
						if (type === 'refresh') {
							uni.stopPullDownRefresh();
						}
						this.loadingType = r.data.length === 10 ? 'more' : 'nomore';
						this.worksList = [...this.worksList, ...r.data];
					})
					.catch(() => {
						this.loading = false;
						if (type === 'refresh') {
							uni.stopPullDownRefresh();
						}
					});
			},
			navToLogin(route) {
				this.$mRouter.push({
					route
				});
			},
			navTo(route) {
				this.$mRouter.push({
					route
				});
			}
		}
	};


</script>

<style lang="scss">
	
	
	.title-in1line{
		font-weight: bolder;
		font-size: 19px;
	}
	
	.uni-media-list-text-bottom {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
	}

	.date {
		display: inline-block;
		width: 180upx;
		font-size: $font-sm + 1upx;
		color: $font-color-base;
	}
	.tit {
		width: 120upx;
		font-size: $font-sm + 1upx;
		text-align:center;
	    color: $font-color-base;
		border-radius:25px;
		-moz-border-radius:25px;
	}
	page {
		background-color: $page-color-base;
	}
	
    .input-item {
		display: inline-block;
		
		// width: 15%;
	}
	.visit {
		.uni-media-list-logo {
			width: 180rpx;
			height: 140rpx;
		}

		.uni-media-list-body {
			height: auto;
			justify-content: space-around;
		}

		.uni-media-list-text-top {
			height: 74rpx;
			font-size: 28rpx;
			overflow: hidden;
		}

		.uni-media-list-text-bottom {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
		}

		.add-round {
			position: fixed;
			z-index: 999;
			right: 30rpx;
			bottom: 30rpx;
			border-radius: 50%;
			width: 120rpx;
			height: 120rpx;
			color: #fff;
			text-align: center;
			line-height: 120rpx;
			font-weight: 100;
			font-size: 80rpx;
		}

		.notify-list {
			margin-top: 20upx;
			
			.read {
				text-align: right;
				margin-right: $spacing-base;
				margin-top: $spacing-base;
				margin-bottom: $spacing-sm;

				text {
					margin-left: $spacing-base;
				}
			}

			.row {
				width: calc(100%);
				height: calc(22vw + 40upx);
				
				border-radius: 15upx;
				box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
				display: flex;
				align-items: center;
				position: relative;
				overflow: hidden;
				z-index: 4;
				border: 0;

				.menu {
					.iconfont {
						color: #fff;
						font-size: 60upx;
					}

					position: absolute;
					width: 29%;
					height: 100%;
					right: 0;
					display: flex;
					justify-content: center;
					align-items: center;
					color: #fff;
					z-index: 2;
				}
				
				.carrier {
					@keyframes showMenu {
						0% {
							transform: translateX(0);
						}

						100% {
							transform: translateX(-30%);
						}
					}

					@keyframes closeMenu {
						0% {
							transform: translateX(-30%);
						}

						100% {
							transform: translateX(0);
						}
					}

					&.open {
						animation: showMenu 0.25s linear both;
					}

					&.close {
						animation: closeMenu 0.15s linear both;
					}

					background-color: #fff;
					position: absolute;
					width: 100%;
					padding: 0 0;
					height: 100%;
					z-index: 3;
					display: flex;
					align-items: center;
				}
			}

			.notify-wrapper {
				background-color: $color-white;
				width: 100%;
				padding: $spacing-base $spacing-lg $spacing-base $spacing-lg;
				margin: $spacing-base 0 0;
				border-radius: 15upx;
				position: relative;

				.title {
					font-size: $font-lg;
					color: $font-color-dark;
					font-weight: 500;
					margin: 0 0 $spacing-sm;
				}

				.content {
					font-size: $font-sm;
					color: $font-color-base;
					height: 75upx;
					line-height: 36upx;
				}

				.time {
					font-size: $font-base;
					color: $font-color-light;
				}

				.type {
					position: absolute;
					top: 26upx;
					left: -10upx;
					border: none;
					font-size: $font-sm;
					opacity: 0.8;
				}

				.un-read {
					display: inline-block;
					width: 12upx;
					height: 12upx;
					border-radius: 50%;
					position: absolute;
					top: 32upx;
					right: 30upx;
				}
			}
		}

		.notify-empty {
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100vh;
			padding-bottom: 100upx;
			display: flex;
			justify-content: center;
			flex-direction: column;
			align-items: center;
			background: #fff;

			.iconfont {
				font-size: $font-lg + 100upx;
			}

			.empty-tips {
				display: flex;
				font-size: $font-sm + 2upx;
				color: $font-color-disabled;

				.navigator {
					margin-left: 16upx;
				}
			}
		}

		.works-empty {
			position: fixed;
			left: 0;
			top: 0;
			width: 100%;
			height: 100vh;
			padding-bottom: 100upx;
			display: flex;
			justify-content: center;
			flex-direction: column;
			align-items: center;
			background: #fff;

			.iconfont {
				font-size: $font-lg + 100upx;
			}

			.empty-tips {
				display: flex;
				font-size: $font-sm + 2upx;
				color: $font-color-disabled;

				.navigator {
					margin-left: 16upx;
				}
			}
		}
	}
</style>
